package eclipse_sync_plugin;

import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class PluginPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
    public static final String PREF_ECLIPSE_PATH = "eclipse_path";
    public static final String PREF_CURSOR_PATH = "cursor_path";
    public static final String PREF_PYTHON_PATH = "python_path";
    
    public PluginPreferencePage() {
        super(GRID);
        setPreferenceStore(Activator.getDefault().getPreferenceStore());
        setDescription("配置Eclipse、Cursor和Python的路径");
    }

    @Override
    protected void createFieldEditors() {
        addField(new StringFieldEditor(PREF_ECLIPSE_PATH, "Eclipse路径:", getFieldEditorParent()));
        addField(new StringFieldEditor(PREF_CURSOR_PATH, "Cursor路径:", getFieldEditorParent()));
        addField(new StringFieldEditor(PREF_PYTHON_PATH, "Python解释器路径:", getFieldEditorParent()));
    }

    @Override
    public void init(IWorkbench workbench) {
        // 设置默认值
        getPreferenceStore().setDefault(PREF_ECLIPSE_PATH, "D:\\eclipse2024\\jee-2024-12\\eclipse\\eclipse.exe");
        getPreferenceStore().setDefault(PREF_CURSOR_PATH, "C:\\Users\\ThinkPad\\AppData\\Local\\Programs\\cursor\\Cursor.exe");
        getPreferenceStore().setDefault(PREF_PYTHON_PATH, "python");
    }
} 